clear
clc
 datasetsAio ={ 'bbcnewssport_737n_1000d_5c_uni_12k','RELATHE_1427n_4322d_2c_tfidf_uni_12k',...
    'warpPIE10P_210n_2420d_10c_12k','COIL20_1440n_1024d_20c_uni_12k',...
    'UMIST_575n_644d_20c_12k','BASEHOCK_1993n_4862d_2c_tfidf_uni_12k',...
     'leukemia_72n_7070d_2c_12k','ALLAML_72n_7129d_2c_12k',...   
};
 indicator={'acc_onmkc_res','nmi_onmkc_res','purity_onmkc_res'}    
addpath(fullfile(pwd, '..', 'lib'));
for i1 = 1:length(datasetsAio)
load(fullfile(pwd, '..', 'data', datasetsAio{i1}));
numclass = length(unique(Y));
numker = size(Ks,3);
num = size(Ks,1);
Ks = kcenter(Ks);
Ks = knorm(Ks);

M = calculateM(Ks);
rhoset2 = 2.^[-15:2:15];
lambdaset2 = 2.^[-15:2:15];
accval2 = zeros(length(rhoset2),length(lambdaset2));
nmival2 = zeros(length(rhoset2),length(lambdaset2));
purval2 = zeros(length(rhoset2),length(lambdaset2));
ts = zeros(length(rhoset2),length(lambdaset2));
res_onmkc_aio=[];
res_param=[];
for ind=1:3
     load(fullfile(pwd, '..', 'onmkc_res.mat'));
     s=eval([indicator{ind}]);
      rhos =s(i1,1);
      lambdas =s(i1,2);
        tic;
        [res_onmkc] = myoptimalNeighborhoodkernelclustering(Y,Ks,M,numclass,rhos,lambdas);
res_onmkc=res_onmkc(:,ind);
  res_onmkc_aio=mean(res_onmkc,1);
save(['..\','metricresult\',datasetsAio{i1},'_', indicator{ind},'_.mat'],'res_onmkc');
save([datasetsAio{i1},'_', indicator{ind},'_.mat'],'res_onmkc');
end

end
